<?php

namespace App\Models\Common;

use App\Models\Member\Member;
use App\Models\Sys\User;
use Emadadly\LaravelUuid\Uuids;
use WeSoonNet\LaravelPlus\Traits\Timezone;
use Illuminate\Database\Eloquent\Model;

class Push extends Model
{
    use Uuids, Timezone;

    protected $table        = 'com_push';
    protected $guarded      = ['created_at', 'updated_at'];
    protected $hidden       = ['pivot'];
    protected $casts        = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s',
        'deleted_at' => 'datetime:Y-m-d H:i:s',
    ];

    public static $stateArr = [
        -10 => '推送失败',
        0 => '等待推送',
        5 => '推送中',
        10 => '推送完成',
    ];

    //推送群体
    public function sends()
    {
        return $this->hasMany(PushSend::class, 'push_uuid', 'uuid');
    }
}
